home *** CD-ROM | disk | FTP | other *** search
- Path: news.uh.edu!usenet
- From: Sensarn <txs53132@bayou.uh.edu>
- Newsgroups: comp.lang.c++
- Subject: Re: How do I make a virtual screen in Turbo C++?
- Date: 27 Jan 1996 00:49:22 GMT
- Organization: AEtna Insurance Agency
- Message-ID: <4ebsqi$pp0@masala.cc.uh.edu>
- References: <4e94jd$rte@maureen.teleport.com>
- NNTP-Posting-Host: sip-14260.public-dialups.uh.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
-
- Here is a standard double buffering technique:
-
- //Allocate memory for double buffer
- unsigned char far *double_buffer=(unsigned char far *)farmalloc(64001);
- //Pointer to the video memory
- unsigned char far *video_buffer=(unsigned char far *)0xA0000000;
- //Screen 13h
- asm {
- mov ax,0x13;Store screen mode in AX
- int 0x10;interrupt 10h -- video stuff
- }
- //Load screen
- asm {
- les di,double_buffer;ES:DI destination points to double_buffer
- lds si,video_buffer;DS:SI source points to video_buffer
- mov cx,32000;32000 words to move
- cld;Clear the direction flag -- in case you are pointing backward
- rep movsw;Move DS:SI to ES:DI one word at a time -- inc's SI
- }
- //Double buffer now contains screen
- //Clear screen
- asm {
- les di,video_buffer
- mov cx,32000
- xor ax,ax;AX is value to write -- 0h is black
- cld
- rep stosw;Store AX in ES:DI -- inc's DI
- }
- //Display double buffer
- asm {
- les di,video_buffer
- lds si,double_buffer
- mov cx,32000
- cld
- rep movsw
- }
-
- Steven Sensarn - txs53132@bayou.uh.edu
-
-